package com.shrcl.engineerprocess.domain.impl;

import com.shrcl.engineerprocess.domain.EngineerCertificationTimerService;
import edu.fudan.mylang.pf.BaseService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

@Service("com.shrcl.engineerprocess.domain.impl.EngineerCertificationTimerServiceImpl")
public class EngineerCertificationTimerServiceImpl extends BaseService implements EngineerCertificationTimerService {
  @Scheduled(cron = "0 0 9 * * ?")
  public void checkTimer() {
    final com.shrcl.engineerprocess.domain.EngineerCertificationStatus __effective = com.shrcl.engineerprocess.domain.EngineerCertificationStatus.effective;
    edu.fudan.mylang.pf.IGenericQuery<com.shrcl.engineerprocess.domain.EngineerCertification> query=getObjectFactory().createGenericQuery(com.shrcl.engineerprocess.domain.EngineerCertification.class,"select e from com.shrcl.engineerprocess.domain.impl.EngineerCertificationImpl as e where  e.Status = :__effective ").setParameter("__effective",__effective);
    java.util.Collection<com.shrcl.engineerprocess.domain.EngineerCertification> _list = query.list();
    final org.eclipse.xtext.xbase.lib.Procedures.Procedure1<com.shrcl.engineerprocess.domain.EngineerCertification> _function = new org.eclipse.xtext.xbase.lib.Procedures.Procedure1<com.shrcl.engineerprocess.domain.EngineerCertification>() {
    	public void apply(final com.shrcl.engineerprocess.domain.EngineerCertification it) {
    		it.checkTimer();
    	}
    };
    org.eclipse.xtext.xbase.lib.IterableExtensions.<com.shrcl.engineerprocess.domain.EngineerCertification>forEach(_list, _function);
    
    
  }
  
  @Scheduled(cron = "0 0 9 * * ?")
  public void checkExpiredTimer() {
    final com.shrcl.engineerprocess.domain.EngineerCertificationStatus __abouttoexpired = com.shrcl.engineerprocess.domain.EngineerCertificationStatus.abouttoexpired;
    final com.shrcl.engineerprocess.domain.EngineerCertificationStatus __effective = com.shrcl.engineerprocess.domain.EngineerCertificationStatus.effective;
    edu.fudan.mylang.pf.IGenericQuery<com.shrcl.engineerprocess.domain.EngineerCertification> query=getObjectFactory().createGenericQuery(com.shrcl.engineerprocess.domain.EngineerCertification.class,"select e from com.shrcl.engineerprocess.domain.impl.EngineerCertificationImpl as e where  e.Status = :__abouttoexpired or e.Status = :__effective ").setParameter("__abouttoexpired",__abouttoexpired).setParameter("__effective",__effective);
    java.util.Collection<com.shrcl.engineerprocess.domain.EngineerCertification> _list = query.list();
    final org.eclipse.xtext.xbase.lib.Procedures.Procedure1<com.shrcl.engineerprocess.domain.EngineerCertification> _function = new org.eclipse.xtext.xbase.lib.Procedures.Procedure1<com.shrcl.engineerprocess.domain.EngineerCertification>() {
    	public void apply(final com.shrcl.engineerprocess.domain.EngineerCertification it) {
    		it.checkExpiredTimer();
    	}
    };
    org.eclipse.xtext.xbase.lib.IterableExtensions.<com.shrcl.engineerprocess.domain.EngineerCertification>forEach(_list, _function);
    
    
  }
}
